package com.kotlin.baselib.ext

import android.content.Context
import com.kotlin.baselib.rx.BaseObserver
import com.kotlin.baselib.utils.ToastUtil
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
import io.reactivex.rxjava3.core.Observable
import io.reactivex.rxjava3.schedulers.Schedulers


fun <T>Observable<T>.execute(observer : BaseObserver<T>){
    this.observeOn(AndroidSchedulers.mainThread())
            .subscribeOn(Schedulers.io())
            .subscribe(observer)
}

fun Any.toast(context : Context){
    ToastUtil.showToast(context,this.toString())
}